﻿using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

namespace Apewer.Models
{

    /// <summary>属性信息。</summary>
    public class Property
    {

        /// <summary>对象实例。</summary>
        public object Instance { get; set; }

        /// <summary>所属类型。</summary>
        public Type Type { get; set; }

        /// <summary>属性信息。</summary>
        public PropertyInfo Information { get; set; }

        /// <summary>属性的 Get 方法，不存在时为 NULL 值。</summary>
        public MethodInfo Getter { get; set; }

        /// <summary>属性的 Get 方法，不存在时为 NULL 值。</summary>
        public MethodInfo Setter { get; set; }

        /// <summary>属性包含 Get 方法。</summary>
        public bool HasGet { get { return Getter != null; } }

        /// <summary>属性包含 Set 方法。</summary>
        public bool HasSet { get { return Setter != null; } }

        /// <summary>静态属性。</summary>
        public bool IsStatic
        {
            get
            {
                if (Getter != null) return Getter.IsStatic;
                if (Setter != null) return Getter.IsStatic;
                return false;
            }
        }

    }

}
